﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Core.Extensions;
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using QdpzWtm.Models.BaseSeting;


namespace QdpzWtm.BaseSeting.ViewModels.ArticleManagementTypeVMs
{
    public partial class ArticleManagementTypeListVM : BasePagedListVM<ArticleManagementType_View, ArticleManagementTypeSearcher>
    {
        protected override List<GridAction> InitGridAction()
        {
            return new List<GridAction>
            {
                this.MakeStandardAction("ArticleManagementType", GridActionStandardTypesEnum.Create, Localizer["Sys.Create"],"BaseSeting", dialogWidth: 800),
                this.MakeStandardAction("ArticleManagementType", GridActionStandardTypesEnum.Edit, Localizer["Sys.Edit"], "BaseSeting", dialogWidth: 800),
                this.MakeStandardAction("ArticleManagementType", GridActionStandardTypesEnum.Delete, Localizer["Sys.Delete"], "BaseSeting", dialogWidth: 800),
                this.MakeStandardAction("ArticleManagementType", GridActionStandardTypesEnum.Details, Localizer["Sys.Details"], "BaseSeting", dialogWidth: 800),
                this.MakeStandardAction("ArticleManagementType", GridActionStandardTypesEnum.BatchEdit, Localizer["Sys.BatchEdit"], "BaseSeting", dialogWidth: 800),
                this.MakeStandardAction("ArticleManagementType", GridActionStandardTypesEnum.BatchDelete, Localizer["Sys.BatchDelete"], "BaseSeting", dialogWidth: 800),
                this.MakeStandardAction("ArticleManagementType", GridActionStandardTypesEnum.Import, Localizer["Sys.Import"], "BaseSeting", dialogWidth: 800),
                this.MakeStandardAction("ArticleManagementType", GridActionStandardTypesEnum.ExportExcel, Localizer["Sys.Export"], "BaseSeting"),
            };
        }


        protected override IEnumerable<IGridColumn<ArticleManagementType_View>> InitGridHeader()
        {
            return new List<GridColumn<ArticleManagementType_View>>{
                this.MakeGridHeader(x => x.ArticleManagementTypeName),
                this.MakeGridHeader(x => x.Remark),
                this.MakeGridHeaderAction(width: 200)
            };
        }

        public override IOrderedQueryable<ArticleManagementType_View> GetSearchQuery()
        {
            var query = DC.Set<ArticleManagementType>()
                .CheckContain(Searcher.ArticleManagementTypeName, x=>x.ArticleManagementTypeName)
                .Select(x => new ArticleManagementType_View
                {
				    ID = x.ID,
                    ArticleManagementTypeName = x.ArticleManagementTypeName,
                    Remark = x.Remark,
                })
                .OrderBy(x => x.ID);
            return query;
        }

    }

    public class ArticleManagementType_View : ArticleManagementType{

    }
}
